package com.liangzhong.modules.Main.Mediator
{
	import com.common.utils.Reflection;
	import com.global.GlobalDef;
	import com.liangzhong.constants.ApplicationConstants;
	import com.liangzhong.constants.NotificationConstants;
	import com.liangzhong.events.AppEventDispatcher;
	import com.liangzhong.events.MainEvent;
	import com.liangzhong.events.NotifierEvent;
	import com.liangzhong.mediator.BaseMediator;
	import com.liangzhong.model.AppData;
	import com.liangzhong.modules.PlayerCenter.mediator.PlayerCenterMediator;
	import com.liangzhong.modules.activity.mediator.AccumulateConsumptionMediator;
	import com.liangzhong.modules.activity.mediator.CDKeyAwardMediator;
	import com.liangzhong.modules.activity.mediator.ChristmasMediator;
	import com.liangzhong.modules.activity.mediator.FestivalMediator;
	import com.liangzhong.modules.activity.mediator.LZTeamMediator;
	import com.liangzhong.modules.activity.mediator.LevelActivityMediator;
	import com.liangzhong.modules.activity.mediator.LivenessMediator;
	import com.liangzhong.modules.activity.mediator.MakeStarMediator;
	import com.liangzhong.modules.activity.mediator.MatchWelfaremediator;
	import com.liangzhong.modules.activity.mediator.OpenserveMediator;
	import com.liangzhong.modules.activity.mediator.QzoneMediator;
	import com.liangzhong.modules.activity.mediator.ThefirstchargeMediator;
	import com.liangzhong.modules.activity.mediator.TimelimitDiscountMediator;
	import com.liangzhong.modules.activity.mediator.TopupRebateMediator;
	import com.liangzhong.modules.activity.mediator.TopupfeedbackMediator;
	import com.liangzhong.modules.activity.mediator.VipMediator;
	import com.liangzhong.modules.bag.mediator.BagMediator;
	import com.liangzhong.modules.club.mediator.ClubMediator;
	import com.liangzhong.modules.compete.mediator.CompeteMediator;
	import com.liangzhong.modules.court.CourtMediator.CourtMediator;
	import com.liangzhong.modules.explore.mediator.ExploreMediator;
	import com.liangzhong.modules.fameHall.mediator.FameHallMediator;
	import com.liangzhong.modules.friend.mediator.FriendMediator;
	import com.liangzhong.modules.goldpalace.mediator.GoldPalaceMediator;
	import com.liangzhong.modules.guess.mediator.GuessMediator;
	import com.liangzhong.modules.guide.mediator.GuideSettingMediator;
	import com.liangzhong.modules.ladderMatch.mediator.LadderMatchMediator;
	import com.liangzhong.modules.leagueMatch.mediator.LeagueMatchMediator;
	import com.liangzhong.modules.mail.mediator.MailMediator;
	import com.liangzhong.modules.rankinglist.mediator.RankingListMediator;
	import com.liangzhong.modules.shop.mediator.ShopMediator;
	import com.liangzhong.modules.techBar.mediator.TechBarMediator;
	import com.liangzhong.modules.trainingcamp.mediator.TrainingcampMediator;
	import com.liangzhong.modules.user.mediator.UserMediator;
	import com.liangzhong.modules.winebar.mediator.WineBarMediator;
	import com.liangzhong.modules.youngTrain.mediator.YoungTrainMediator;
	import com.liangzhong.proxyconstant.activity.ActivityConst;
	import com.lz.football.module.main.view.IMainView;
	
	import flash.display.DisplayObject;
	import flash.display.StageDisplayState;
	import flash.events.Event;
	
	import lz.controls.Alert;
	
	import org.puremvc.as3.interfaces.INotification;
	
	/**
	 *主界面mediator 
	 * @author lxh
	 * 
	 */	
	public class MainMediator extends BaseMediator
	{
		public static const MediatorName :String = "MainMediator";
		
		public function MainMediator(mediatorName:String=null, viewComponent:Object=null)
		{
			super(mediatorName, viewComponent);
		}
		/**
		 *获取 实例 
		 * @return 
		 * 
		 */		
		public function get mainView():IMainView
		{
			return viewComponent as IMainView;
		}
		/**
		 * 初始化
		 * 
		 */		
		override public function initMediator():void
		{
			addEventListeners();
		}
		/**
		 * 
		 * 添加事件
		 */		
		override public function addEventListeners():void
		{
			AppEventDispatcher.getInstance().addEventListener(NotifierEvent.SHOW_TASKINFO_PANEL,showTaskInfoPanel);
			AppEventDispatcher.getInstance().addEventListener(NotifierEvent.CLOSE_TASKINFO_PANEL,closeTaskInfoPanel);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Remove_Second_Scene,onRemoveSecSceneHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Club_View,onOpenClubViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Trade_View,onOpenTradeViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Bag_View,onOpenBagViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Match_View,onOpenMatchViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Setting_View,onOpenSettingViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Shop_View,onOpenShopViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Train_View,onOpenTrainViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Honour_View,onOpenHonourViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Mail_View,onOpenMailViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Equip_View,onOpenEquipViewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_TourMatch_View,onOpenTourMatchViewHandler);
			AppEventDispatcher.getInstance().addEventListener(NotifierEvent.SHOW_FRIENDLIST_PANEL,showFriendListPanel);
			AppEventDispatcher.getInstance().addEventListener(NotifierEvent.MAIN_SHOW_NORMAL,onMainShowNormalHandler);
			AppEventDispatcher.getInstance().addEventListener(NotifierEvent.MAIN_SHOW_TOURMATCH,onMainShowTourMatchHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_Tutorial_View,onOpenTutorialHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_YoungTrain_View,onOpenYoungTrainHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_PLAYERCENTER,onOpenplayercenterHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_WineBar_View,onOpenWineBarHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.Open_TechBar_View,onOpenTechBarHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_COURT_VIEW,onCoutviewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_LEAGUEMATCH_VIEW,onLeagueMatchHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_COMPETE_VIEW,oncompeteHandler);
			
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_FRIEND_VIEW,onfriendviewHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_EXPLORE_VIEW,onExploreHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_LADDER_VIEW,onLadderMatchHandler);
			
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_LIVENESS,onLIVENESSHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_MAKESTAR,onmakestarHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_LEVEL_ACTIVITY,onLevelActivityHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_VIP_ACTIVITY,onvipActivityHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_FIRST_CHARGE,onfirstChargeHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_QZONE_VIEW,onOpenQzoneHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_RANK_LIST,onRankListHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_CHRISTMAS_VIEW,onOpenChristmasHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_TOPUP_ACTIVE,onOpenTopupHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_LZTEAM_VIEW,onOpenLZTeamHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_GUESS_VIEW,onOpenGuessHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_PALACE_VIEW,onGoldPalaceHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_FAMEHALL_VIEW,onOpenfameHallHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_CDKEY_VIEW,onOpenCDKeyHandler);
			
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_FESTIVAL_VIEW,onOpenFestivalHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_OPENSERVE_VIEW,onOpenOpenServeHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_TIMELIMIT_VIEW,onOpenTimeLimitHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_MATCHWELFARE_VIEW,onOpenMatchWelfareHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.OPEN_ACCUMCON_VIEW,onOpenaccumconHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.ONLINEAWARD,onOnlineHandler);
			AppEventDispatcher.getInstance().addEventListener(MainEvent.TOPUPREBATE_VIEW,onOpenTopUpbeateHandler);
		
		}
		
		protected function onOpenTopUpbeateHandler(event:Event):void
		{
			// TODO Auto-generated method stub
			if(!facade.hasMediator(TopupRebateMediator.MediatorName))
				facade.registerMediator(new TopupRebateMediator(TopupRebateMediator.MediatorName));
		}
		
		protected function onOnlineHandler(event:Event):void
		{
			// TODO Auto-generated method stub
			this.sendNotification(ActivityConst.REQUEST_ONLINE_AWARD);
		}
		/**
		 *累积消费 
		 * @param event
		 * 
		 */
		protected function onOpenaccumconHandler(event:Event):void
		{
			if(!facade.hasMediator(AccumulateConsumptionMediator.MediatorName))
				facade.registerMediator(new AccumulateConsumptionMediator(AccumulateConsumptionMediator.MediatorName));
		}
		
		/**
		 *比赛福利 
		 * @param event
		 * 
		 */
		protected function onOpenMatchWelfareHandler(event:Event):void
		{
			if(!facade.hasMediator(MatchWelfaremediator.MediatorName))
				facade.registerMediator(new MatchWelfaremediator(MatchWelfaremediator.MediatorName));
		}
		/**
		 *限时打折  
		 * @param event
		 * 
		 */		
		protected function onOpenTimeLimitHandler(event:Event):void
		{
			// TODO Auto-generated method stub
			if(!facade.hasMediator(TimelimitDiscountMediator.MediatorName))
				facade.registerMediator(new TimelimitDiscountMediator(TimelimitDiscountMediator.MediatorName));
			
			
			
			
			
//			if(!facade.hasMediator(TopupfeedbackMediator.MediatorName))
//				facade.registerMediator(new TopupfeedbackMediator(TopupfeedbackMediator.MediatorName))
		}
		
		protected function onOpenOpenServeHandler(event:Event):void
		{
			// TODO Auto-generated method stub
			if(!facade.hasMediator(OpenserveMediator.MediatorName))
				facade.registerMediator(new OpenserveMediator(OpenserveMediator.MediatorName));
		}
		
		/**
		 *节日活动礼包 
		 * @param event
		 * 
		 */
		protected function onOpenFestivalHandler(event:Event):void
		{
			// TODO Auto-generated method stub
			if(!facade.hasMediator(FestivalMediator.MediatorName))
				facade.registerMediator(new FestivalMediator(FestivalMediator.MediatorName));
//			
			
			
			
			
		}
		/**
		 *荣誉堂 
		 * @param event
		 * 
		 */		
		protected function onOpenfameHallHandler(event:Event):void
		{
			// TODO Auto-generated method stub
			if(!facade.hasMediator(FameHallMediator.MediatorName))
				facade.registerMediator(new FameHallMediator(FameHallMediator.MediatorName))
		}
		/**
		 *充值活动 
		 * @param event
		 * 
		 */		
		public function onOpenTopupHandler(event:Event):void
		{
			if(!facade.hasMediator(TopupfeedbackMediator.MediatorName))
				facade.registerMediator(new TopupfeedbackMediator(TopupfeedbackMediator.MediatorName))
		}
			
		/**
		 *排行
		 * @param event
		 * 
		 */		
		protected function onRankListHandler(event:Event):void
		{
			if(!facade.hasMediator(RankingListMediator.MediatorName))
				facade.registerMediator(new RankingListMediator(RankingListMediator.MediatorName));
		}
		/**
		 *首充 
		 * @param event
		 * 
		 */		
		protected function onfirstChargeHandler(event:Event):void
		{
			if(!facade.hasMediator(ThefirstchargeMediator.MediatorName))
				facade.registerMediator(new ThefirstchargeMediator(ThefirstchargeMediator.MediatorName));
		}
		/**
		 *  vip 
		 * @param event
		 * 
		 */		
		protected function onvipActivityHandler(event:Event):void
		{
			if(!facade.hasMediator(VipMediator.MediatorName))
				facade.registerMediator(new VipMediator(VipMediator.MediatorName));
			
//			if(!facade.hasMediator(ThefirstchargeMediator.MediatorName))
//				facade.registerMediator(new ThefirstchargeMediator(ThefirstchargeMediator.MediatorName));
			
			
//			if(!facade.hasMediator(FestivalMediator.MediatorName))
//				facade.registerMediator(new FestivalMediator(FestivalMediator.MediatorName));
			
//			if(!facade.hasMediator(TopupfeedbackMediator.MediatorName))
//				facade.registerMediator(new TopupfeedbackMediator(TopupfeedbackMediator.MediatorName))
		}		
		/**
		 *等级 
		 * @param event
		 * 
		 */		
		protected function onLevelActivityHandler(event:Event):void
		{
			if(!facade.hasMediator(LevelActivityMediator.MediatorName))
				facade.registerMediator(new LevelActivityMediator(LevelActivityMediator.MediatorName));
		}
		/**
		 *七步造星 
		 * @param event
		 * 
		 */		
		protected function onmakestarHandler(event:Event):void
		{
			if(!facade.hasMediator(MakeStarMediator.MediatorName))
			{
				facade.registerMediator(new MakeStarMediator(MakeStarMediator.MediatorName));
			}
		}
		/**
		 *活跃度
		 * @param event
		 * 
		 */		
		protected function onLIVENESSHandler(event:Event):void
		{
			if(!facade.hasMediator(LivenessMediator.MediatorName))
			{
				facade.registerMediator(new LivenessMediator(LivenessMediator.MediatorName));
			}
		}
		/**
		 *国家对抗赛 
		 * @param event
		 * 
		 */		
		protected function oncompeteHandler(event:Event):void
		{
			if(!facade.hasMediator(CompeteMediator.MediatorName))
			{
				facade.registerMediator(new CompeteMediator(CompeteMediator.MediatorName));
			}
		}
		/**
		 *天梯赛 
		 * @param event
		 * 
		 */		
		protected function onLadderMatchHandler(event:Event):void
		{
			if(!facade.hasMediator(LadderMatchMediator.MediatorName))
				facade.registerMediator(new LadderMatchMediator(LadderMatchMediator.MediatorName));
		}
		/**
		 *好友 
		 * @param event
		 * 
		 */		
		protected function onExploreHandler(event:Event):void
		{
			if(!facade.hasMediator(ExploreMediator.MediatorName))
			{
				facade.registerMediator(new ExploreMediator(ExploreMediator.MediatorName));
			}
		}
		
		protected function onfriendviewHandler(event:Event):void
		{
			if(!facade.hasMediator(FriendMediator.MediatorName))
			{
				facade.registerMediator(new FriendMediator(FriendMediator.MediatorName));
			}
		}
		/**
		 *球场 
		 * @param event
		 * 
		 */		
		protected function onCoutviewHandler(event:Event):void
		{
			if(!facade.hasMediator(CourtMediator.MediatorName))
			{
				facade.registerMediator(new CourtMediator(CourtMediator.MediatorName));
			}
		}
		/**
		 *球员中心 
		 * @param event
		 * 
		 */		
		protected function onOpenplayercenterHandler(event:MainEvent):void
		{
			if(!facade.hasMediator(PlayerCenterMediator.MediatorName))
			{
				facade.registerMediator(new PlayerCenterMediator(PlayerCenterMediator.MediatorName,null,event.param));

			}else
			{
				var proxy:PlayerCenterMediator = facade.retrieveMediator(PlayerCenterMediator.MediatorName) as PlayerCenterMediator;
				proxy.showViewType(event.param);
			}
		}
		/**
		 *打开俱乐部界面 
		 * @param e
		 * 
		 */		
		private function onOpenClubViewHandler(e :MainEvent):void
		{
			if(!facade.hasMediator(ClubMediator.MediatorName))
			{
				facade.registerMediator(new ClubMediator(ClubMediator.MediatorName));
			}
		}
		/**
		 *打开交易中心界面 
		 * @param e
		 * 
		 */		
		private function onOpenTradeViewHandler(e :MainEvent):void
		{
			
		}
		/**
		 *打开背包界面 
		 * @param e
		 * 
		 */		
		private function onOpenBagViewHandler(e :MainEvent):void
		{
			facade.registerMediator(new BagMediator(BagMediator.MediatorName));
		}
		/**
		 *打开比赛馆界面 
		 * @param e
		 * 
		 */		
		private function onOpenMatchViewHandler(e :MainEvent):void
		{
			
		}
		/**
		 *打开设置界面 
		 * @param e
		 * 
		 */		
		private function onOpenSettingViewHandler(e :MainEvent):void
		{
			if(GlobalDef.GameStage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE
			|| GlobalDef.GameStage.displayState == StageDisplayState.FULL_SCREEN)
			{
				//GlobalDef.GameStage.displayState = StageDisplayState.NORMAL;
			}
			else
			{
				//GlobalDef.GameStage.displayState = StageDisplayState.FULL_SCREEN;
			}
		}
		/**
		 *打开商城界面 
		 * @param e
		 * 
		 */		
		private function onOpenShopViewHandler(e :MainEvent):void
		{
			if(AppData.getInstance().clubDatamanager.clubInfo.level < 6)
			{
				Alert.showErrorTip("俱乐部6级开放商城！");
				return;
			}
			facade.registerMediator(new ShopMediator(ShopMediator.MediatorName));
		}
		/**
		 *打开训练场界面 
		 * @param e
		 * 
		 */		
		private function onOpenTrainViewHandler(e :MainEvent):void
		{
			if(AppData.getInstance().clubDatamanager.clubInfo.level < 10)
			{
				Alert.showErrorTip("俱乐部10级开放训练营！");
				return;
			}
			facade.registerMediator(new TrainingcampMediator(TrainingcampMediator.MediatorName));
		}
		
		/**
		 *打开荣誉室界面 
		 * @param e
		 * 
		 */		
		private function onOpenHonourViewHandler(e :MainEvent):void
		{
			
		}
		/**
		 *打开装备界面 
		 * @param e
		 * 
		 */		
		private function onOpenEquipViewHandler(e :MainEvent):void
		{
			
		}
		/**
		 *打开邮箱界面 
		 * @param e
		 * 
		 */		
		private function onOpenMailViewHandler(e :MainEvent):void
		{
			facade.registerMediator(new MailMediator(MailMediator.MediatorName));
		}
		/**
		 *打开巡回赛界面 
		 * @param e
		 * 
		 */		
		private function onOpenTourMatchViewHandler(e :MainEvent):void
		{
		}
		/**
		 *打开教程 
		 * @param e
		 * 
		 */		
		private function onOpenTutorialHandler(e :MainEvent):void
		{
		}
		/**
		 *打开青训营 
		 * @param e
		 * 
		 */		
		private function onOpenYoungTrainHandler(e :MainEvent):void
		{
			facade.registerMediator(new YoungTrainMediator(YoungTrainMediator.MediatorName));
		}
		/**
		 *打开酒吧 
		 * @param e
		 * 
		 */		
		private function onOpenWineBarHandler(e :MainEvent):void
		{
			facade.registerMediator(new WineBarMediator(WineBarMediator.MediatorName));
		}
		/**
		 *打开科技馆
		 * @param e
		 * 
		 */		
		private function onOpenTechBarHandler(e :MainEvent):void
		{
			facade.registerMediator(new TechBarMediator(TechBarMediator.MediatorName));
		}
		/**
		 *联赛 
		 * @param e
		 * 
		 */		
		private function onLeagueMatchHandler(e :MainEvent):void
		{
			facade.registerMediator(new LeagueMatchMediator(LeagueMatchMediator.MediatorName));
		}
		/**
		 * 黄钻 
		 * @param e
		 * 
		 */		
		private function onOpenQzoneHandler(e :MainEvent):void
		{
			facade.registerMediator(new QzoneMediator(QzoneMediator.MediatorName));
		}
		/**
		 * 圣诞
		 * @param e
		 * 
		 */		
		private function onOpenChristmasHandler(e :MainEvent):void
		{
			facade.registerMediator(new ChristmasMediator(ChristmasMediator.MediatorName));
		}
		/**
		 * 良众队 
		 * @param e
		 * 
		 */		
		private function onOpenLZTeamHandler(e :MainEvent):void
		{
			facade.registerMediator(new LZTeamMediator(LZTeamMediator.MediatorName));
		}
		/**
		 *打开激活码 
		 * @param e
		 * 
		 */		
		private function onOpenCDKeyHandler(e :MainEvent):void
		{
			facade.registerMediator(new CDKeyAwardMediator(CDKeyAwardMediator.MediatorName));
		}
		/**
		 *打开竞猜页面 
		 * @param e
		 * 
		 */		
		private function onOpenGuessHandler(e :MainEvent):void
		{
			facade.registerMediator(new GuessMediator(GuessMediator.MediatorName));
		}
		/**
		 *打开黄金12宫 
		 * @param e
		 * 
		 */		
		private function onGoldPalaceHandler(e :MainEvent):void
		{
			facade.registerMediator(new GoldPalaceMediator(GoldPalaceMediator.MediatorName));
		}
		/**
		 *显示任务信息面板 
		 * @param e
		 * 
		 */		
		private function showTaskInfoPanel(e :NotifierEvent):void
		{
			mainView.showTaskFadeOut();
		}
		/**
		 *关闭任务信息面板 
		 * @param e
		 * 
		 */		
		private function closeTaskInfoPanel(e :NotifierEvent):void
		{
			mainView.closeTaskFadeIn();
		}
		/**
		 *显示好友列表面板 
		 * @param e
		 * 
		 */		
		private function showFriendListPanel(e :NotifierEvent):void
		{
			mainView.showFriendListPanel();
		}
		/**
		 * 主界面显示正常
		 */		
		private function onMainShowNormalHandler(e :*):void
		{
			mainView.showNormalUI();
			//获取签到信息
			this.sendNotification(ApplicationConstants.Login_Get_Login_Award_Info);
			//请求好友列表
			this.sendNotification(ApplicationConstants.FRIEND_GETFRIENDLIST);
			//注册mediator
			registerModuleMediator();
		}
		/**
		 *显示巡回赛 
		 * @param e
		 */		
		private function onMainShowTourMatchHandler(e :*):void
		{
			mainView.showTourMatch();
		}
		/**
		 * 捕获
		 * @param notification
		 * 
		 */		
		override public function handleNotification(notification:INotification):void
		{
			switch(notification.getName())
			{
				case NotificationConstants.MAINVIEW_ADD_DISPLAYOBJECT://添加二级场景
				{
					mainView.addDisplayObj(notification.getBody().dispalyObj);
					mainView.type = notification.getBody().type;
					if(notification.getBody().dispalyObj)
					{
						mainView.closeTaskFadeIn();
						//mainView.unShownAnimate();
						GlobalDef.GameWindowContainer.visible = false;
					}
					break;
				}
				case NotificationConstants.MAINVIEW_REMOVE_DISPLAYOBJECT://移除二级场景
				{
					mainView.removeDisplayObj();
					//mainView.showAnimate();
					GlobalDef.GameWindowContainer.visible = true;
					break;
				}
				case NotificationConstants.MATCH_START://比赛开始
				{
					//mainView.unShowMainUI();
					//GlobalDef.GameContainer.mouseChildren = false;
					//GlobalDef.GameContainer.mouseEnabled = false;
					break;
				}
				case NotificationConstants.MATCH_END://比赛结束
				{
					//mainView.showMainUI();
					break;
				}
				case NotificationConstants.GUIDE_START://新手引导开始
				{
					mainView.unShowUpAndDownUI();
					AppData.getInstance().user.isGuideing = true;
					break;
				}
				case NotificationConstants.GUIDE_SET_FINISH://新手设置完成
				{
					mainView.showMainUI();
					mainView.guideSetFinish();
					break;
				}
				case NotificationConstants.GUIDE_FINISH://新手引导完成
				{
					mainView.showUpAndDownUI();
					mainView.showMainUI();
					AppData.getInstance().user.isGuideing = false;
					//获取签到信息
					//this.sendNotification(ApplicationConstants.Login_Get_SignInfo);
					//请求任务列表
					//this.sendNotification(ApplicationConstants.TASK_GETTASKLIST);
					//请求好友列表
					//this.sendNotification(ApplicationConstants.FRIEND_GETFRIENDLIST);
					//请求冲级活动信息
					//this.sendNotification(ApplicationConstants.Activity_Get_Grade_Info);
					//注册mediator
					registerModuleMediator();
					break;
				}
				case NotificationConstants.MAIN_SHOW_UP_DOWN://显示上下面板
				{
					mainView.showUpAndDownUI();
					break;
				}
				case NotificationConstants.MAIN_SHOW_ANIMATE://显示场景动画
				{
					mainView.showAnimate();
					break;
				}
				case NotificationConstants.MAIN_UNSHOW_ANIMATE://隐藏场景动画
				{
					mainView.unShownAnimate();
					break;
				}
				case NotificationConstants.MAIN_SET_CHATPANEL://设置聊天面板
				{
					mainView.setChatPanel(notification.getBody());
					break;
				}
				case NotificationConstants.MAIN_SHOW_CHRISTMAS://圣诞
				{
					mainView.showChristmasEf();
					break;
				}
				case ActivityConst.GET_ONLINE_INFO:
				{
					mainView.showOnlineTime();
					break;
				}
					
			}
		}
		/**
		 * 监听
		 * @return 
		 * 
		 */		
		override public function listNotificationInterests():Array
		{
			return [NotificationConstants.MAINVIEW_ADD_DISPLAYOBJECT,
					NotificationConstants.MAINVIEW_REMOVE_DISPLAYOBJECT,
					NotificationConstants.MATCH_START,
					NotificationConstants.MATCH_END,
					NotificationConstants.GUIDE_START,
					NotificationConstants.GUIDE_SET_FINISH,
					NotificationConstants.GUIDE_FINISH,
					NotificationConstants.MAIN_SHOW_ANIMATE,
					NotificationConstants.MAIN_UNSHOW_ANIMATE,
					NotificationConstants.MAIN_SHOW_UP_DOWN,
					NotificationConstants.MAIN_SET_CHATPANEL,
					NotificationConstants.MAIN_SHOW_CHRISTMAS,
					ActivityConst.GET_ONLINE_INFO];
		}
		/**
		 * 注册模块mediator
		 */		
		private function registerModuleMediator():void
		{
			facade.registerMediator(new UserMediator(UserMediator.MediatorName));//用户
		}
		/**
		 * 注册
		 * 
		 */		
		override public function onRegister():void
		{
			var mView :IMainView = Reflection.createInstance("com.lz.football.module.main.view.MainView");
			mView.initUI();
			viewComponent = mView;;
			GlobalDef.GameContainer.addChild(mView as DisplayObject);
			initMediator();
			if(AppData.getInstance().user.isGuideing)
			{
				mainView.unShowMainUI();
				facade.registerMediator(new GuideSettingMediator(GuideSettingMediator.MediatorName));
			}
		}
		/**
		 *清除二次场景 
		 * @param e
		 * 
		 */
		private function onRemoveSecSceneHandler(e:MainEvent):void
		{
			var type :* = e.param;
			this.sendNotification(type);
			this.sendNotification(NotificationConstants.MAINVIEW_NOTICE_REMOVE_DISPLAYOBJECT);
		}
	}
}